﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;
using Enterprise.DataFactory;
using Enterprise.Infrastructure;
using Enterprise.Model.Doc;
namespace Enterprise.Data.Doc
{
    /// <summary>
    /// 签收记录
    /// </summary>
    public class DocRecevieData
    {
        /// <summary>
        ///  签收数据列表
        /// </summary>
        /// <returns></returns>
        public List<DocRecevieEntity> DocRecevieList()
        {
            List<DocRecevieEntity> list = new List<DocRecevieEntity>();
            string cmd = "Select * from DOC_RECEVIE";
            IDataReader dr = DbExecute.DataReader(cmd);
            while (dr.Read())
            {
                DocRecevieEntity entity = new DocRecevieEntity();
                if (!Convert.IsDBNull(dr["RID"])) entity.RID = Convert.ToInt32(dr["RID"]);
                if (!Convert.IsDBNull(dr["DID"])) entity.DID = Convert.ToInt32(dr["DID"]);
                if (!Convert.IsDBNull(dr["RUSERID"])) entity.RUSERID = Convert.ToInt32(dr["RUSERID"]);
                if (!Convert.IsDBNull(dr["RTIME"])) entity.RTIME = Convert.ToDateTime(dr["RTIME"]);
                list.Add(entity);
            }
            dr.Close();
            return list;
        }

        /// <summary>
        /// 签收数据操作方法
        /// </summary>
        /// <param name="cmd"></param>
        public void Execute(string cmd)
        {
            DbExecute.Execute(cmd);
        }
    }
}
